import axios from "axios";
import service from "@/config/index";

const URLS = {
  SEARCH: `${service.serviceBasic}/consignee/search`,
  IMPORT: `${service.serviceBasic}/consignee/readExcel`,
  BATCH_INSERT: `${service.serviceBasic}/consignee/batchInsert`,
  INSERT: `${service.serviceBasic}/consignee`
};

export default {
  search (filter) {
    return axios.post(URLS.SEARCH, filter);
  },
  insert (filter) {
    return axios.post(URLS.INSERT, filter);
  },
  insertShould (filter) {
    return axios.post(`${service.serviceBasic}/consignee/should`, filter);
  },
  importExcel (file) {
    return axios.post(URLS.IMPORT, file, { timeout: 20000 });
  },
  batchInsert (filter) {
    return axios.post(URLS.BATCH_INSERT, filter);
  },
  // 获取租户所有配置信息
  getConfigCompany (id) {
    return axios.get(`${service.serviceConfig}/configCompany/${id}`);
  },
  // 收货方设置
  getConsigneeReceiving (filter) {
    return axios.post(`/basic/consignee/receiving/time`, filter)
  },
  // 全局时效配置
  globalTimeliness (filter) {
    return axios.post(`/tenant/timeLimit`, filter)
  },
  // 查询租户
  searchTenant () {
    return axios.get(`/tenant`)
  },
};
